/***********************************************************************
 * Module:  JClientLibrary.h
 * Author:  johnneyshi
 * Modified: 2012��12��14�� 16:25:35
 * Purpose: Declaration of the class JClientLibrary
 ***********************************************************************/

#if !defined(__ClassDiagram_JClientLibrary_h)
#define __ClassDiagram_JClientLibrary_h

#include "JUpdateConflict.h"
#include <iostream>
#include "JCommitConflict.h"
#include "JOperateFileResult.h"
#include <vector>
#include "JFile.h"
#include "JCollectFileType.h"
#include "JFileOperationType.h"
#include <string>

class JClientLibrary
{
public:
   JUpdateConflict SubmitUpdateCopy(char* _copyDirPath);
   void ReadConfig(char* _configFileName);
   int SerializeFiles(std::iostream _strea, std::vector<JFile> _files);
   JCommitConflict CommitCopy(char* _copyDirPath);
   void ReSerializeCommitConflicts(std::iostream _strea, std::vector<JCommitConflict> _commitConflicts);
   void CollectFiles(char* _copyDirPath, std::vector<JFile> _files, JCollectFileType _collectType);
   int ReSerializeFilesAndUpdateConflicts(std::iostream _strea, std::vector<JFile> _files, std::vector<JUpdateConflict> _updateConflicts);
   void UpdateCopyBak(std::vector<JFile> _files, std::vector<JUpdateConflict> _updateConflicts);
   void UpdateCopy(std::vector<JFile> _files, std::vector<JUpdateConflict> _updateConflicts);
   void SaveUpdateConflicts(std::vector<JUpdateConflict> _updateConflicts);
   void UpdateCopy(std::vector<JFile> _files, std::vector<JCommitConflict> _commitConflicts);
   void UpdateCopyBak(std::vector<JFile> _files, std::vector<JCommitConflict> _commitConflicts);
   void ReportConflicts(std::vector<JUpdateConflict> _updateConflicts);
   void ReportConflicts(std::vector<JCommitConflict> _commitConflicts);


   std::string CreateWorkingCopies(std::string rootUrl,std::string author,std::string password,std::string _fullPath);
   JOperateFileResult BasicOperAddFile(char* _fileName);
   JOperateFileResult BasicOperUpdateCopy(std::vector<JFile> _files, JFileOperationType _fileOperationType);
   void ReadFile(char* _fileName, JFile _file);
   JOperateFileResult BasicOperDeleteFile(char* _fileName);
   JOperateFileResult BasicOperCopyFile(char* _fileName, char* _newFileName);
   JOperateFileResult BasicOperMoveFile(char* _fileName, char* _newFileName);
   int BasicOperUndoFile(char* _fileName);
   JOperateFileResult BasicOperCheckFile(char* _fileName);

protected:
private:
    std::vector<JUpdateConflict> Update(std::vector<JFile> _files);
    std::vector<JCommitConflict> Commit(std::string _dirPath);
};

#endif